package net.spatula.tally_ho.ui.article.create;

import wicket.markup.html.basic.Label;
import net.spatula.tally_ho.service.ArticleService;
import net.spatula.tally_ho.service.ServiceResult;
import net.spatula.tally_ho.service.beans.ArticleBean;
import net.spatula.tally_ho.service.beans.UserBean;
import net.spatula.tally_ho.ui.AuthenticatedWebPage;
import net.spatula.tally_ho.ui.article.common.ArticleSession;
import net.spatula.tally_ho.ui.signin.Utils;


public class InsertArticle extends AuthenticatedWebPage {

    private static final long serialVersionUID = 1L;

    public InsertArticle() {
        super();
        ArticleSession session = (ArticleSession)getSession();
        ArticleBean article = session.getArticle();
        UserBean user = Utils.getUserBean();
        article.setCreator(user);
        ServiceResult result = ArticleService.getInstance().createArticle(article);
        
        add(new Label("message", result.getMessage()));
               
    }

}
